<?php
/*
 * @Description: 
 * @Author: Leequik
 * @Date: 2024-02-08 19:10:04
 * @LastEditTime: 2025-08-03 22:09:14
 * @LastEditors: Leequik
 */

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\CrudsController;

use App\Services\PostService;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "api" middleware group. Make something great!
|
*/

Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
    return $request->user();
});

/*
Route::resource('/cruds','\CrudsController',[
    'except' => ['edit','show','store']
]);
*/

Route::group(['prefix'=>'/cruds'],function(){
    //Route::get('/','/CrudsController@index');
    Route::get('/',[CrudsController::class, 'index']);

    Route::get('/create',[CrudsController::class, 'create']);
    Route::put('/{id}',[CrudsController::class, 'update']);
    Route::get('/{id}',[CrudsController::class, 'destroy']);

});

// 测试
Route::get('/posts',[PostService::class, 'getPostList']);
Route::get('/pcl',[PostService::class, 'getPostCommentList']);
